package org.jeecg.modules.cosmetic.utils;

import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

/**
 * @author scx
 * @date 2022/7/27 2:19 下午
 */
public enum ImageTypeEnum {

    /**
     * 支持四种类型 JPG/JPEG, GIT, BMP, PNG
     */
    JPG("JPG", XWPFDocument.PICTURE_TYPE_JPEG),
    JPEG("JPEG", XWPFDocument.PICTURE_TYPE_JPEG),
    GIF("GIF", XWPFDocument.PICTURE_TYPE_GIF),
    BMP("BMP", XWPFDocument.PICTURE_TYPE_GIF),
    PNG("PNG", XWPFDocument.PICTURE_TYPE_PNG);
    private String name;
    private Integer typeId;

    ImageTypeEnum(String name, Integer type) {
        this.name = name;
        this.typeId = type;
    }

    public static ImageTypeEnum getTypeIdByName(String name){
        if (StringUtils.isEmpty(name)){
            return null;
        }
        for (ImageTypeEnum imageTypeEnum : ImageTypeEnum.values()){
            if (name.equalsIgnoreCase(imageTypeEnum.name)){
                return imageTypeEnum;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }


}
